package com.bdjk.bdmw.InfoGath.common.constants;

import java.util.HashMap;
import java.util.Map;

import com.bdjk.bdmw.InfoGath.communication.protocol.beianbei.BeiAnBeiLinkProtocol;
import com.bdjk.bdmw.InfoGath.communication.protocol.heremi.HereMiPositionProtocol;
import com.bdjk.bdmw.InfoGath.communication.protocol.iparent.IParentGPSProtocol;

public class ProtocolConstants {

	/************************* 海尔米公司协议正则 ****************************/
	// 海尔米公司名字
	public static final String HEREMI_NAME = "HEREMI";
	
	public static final String HEREMI_POSITION_NAME = "HEREMI_POSITION_PROTOCOL";
	// 海尔米位置协议
	public static final String HEREMI_POSITION_PATTERN = "HM\\*[0-9]{10}\\*[0-9A-Fa-f]{4}\\*UD,[0-3]\\d[0-1]\\d{3},\\d{6},[AV],\\d+(.\\d+)?,[NS],\\d+(.\\d+)?,[EW],((\\d+).(\\d+)?,){3}(\\d+,){5}[0-9A-Fa-f]{4},\\d+,.*";

	/************************* 侨亚爱公司协议正则 ****************************/
	// 侨亚爱公司名字
	public static final String IPARENT_NAME = "IPARENT";
	// 侨亚爱位置协议
	// public final static String IPARENT_POSITION_PATTERN = "^\\[V\\d+.\\d+.\\d+,.*,1,abcd,\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2},\\d-\\d,\\d{15},(-)?\\d,T\\d+,GPS_T\\d+,\\d+(.\\d+)?,\\d+(.\\d+)?,.*,\\d+(.\\d+)?,\\d+(.\\d+)?,\\d+\\]$";
	//
	public static final String IPARENT_GPS_NAME = "IPARENT_GPS_PROTOCOL";
	// 侨亚爱位置协议
	public static final String IPARENT_GPS_PATTERN = "V\\d+.\\d+.\\d+,.*,1,abcd,\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2},\\d-\\d,\\d{15},(-)?\\d,T\\d+,GPS_T\\d+,\\d+(.\\d+)?,\\d+(.\\d+)?,.*,\\d+(.\\d+)?,\\d+(.\\d+)?,\\d+";
	/************************* 贝安贝儿童手表公司协议正则 ****************************/
	//贝安贝公司名字
	public static final String BEIANBEI_LINK_NAME = "BEIANBEI_LINK_PROTOCOL";
	// 贝安贝链接协议
	public static final String BEIANBEI_LINK_PATTERN = "[0-9a-zA-Z][0-9a-zA-Z]\\*\\d{10}\\*[0-9a-fA-f]{4}\\*LK.*";
	// 贝安贝协议名字
	public static final String BEIANBEI_POSITION_NAME = "BEIANBEI_POSITION_PROTOCOL";
	// 贝安贝位置协议
	public static final String BEIANBEI_POSITION_PATTERN = "[0-9a-zA-Z][0-9a-zA-Z]\\*\\d{10}\\*[0-9a-fA-f]{4}\\*UD(2)?,[0-3]\\d[0-1]\\d{3},\\d{6},[AV],\\d+(.\\d+)?,[NS],\\d+(.\\d+)?,[EW],((\\d+).(\\d+)?,){3}(\\d+,){5}[0-9A-Fa-f]{8},\\d+,.*";
	// 贝安贝请求会话协议
	public static final String BEIANBEI_RECORD_NAME = "BEIANBEI_RECORD_PROTOCOL";
	// 贝安贝请求会话协议
	public static final String BEIANBEI_RECORD_PATTERN = "[0-9a-zA-Z][0-9a-zA-Z]\\*\\d{10}\\*[0-9a-fA-f]{4}\\*TKQ";
	// 贝安贝报警协议
	public static final String BEIANBEI_ALARM_NAME = "BEIANBEI_ALARM_PROTOCOL";
	// 贝安贝报警协议
	public static final String BEIANBEI_ALARM_PATTERN = "[0-9a-zA-Z][0-9a-zA-Z]\\*\\d{10}\\*[0-9a-fA-f]{4}\\*AL,[0-3]\\d[0-1]\\d{3},\\d{6},[AV],\\d+(.\\d+)?,[NS],\\d+(.\\d+)?,[EW],((\\d+).(\\d+)?,){3}(\\d+,){5}[0-9A-Fa-f]{8},\\d+,.*";
	// 贝安贝客户端响应协议名字
	public static final String BEIANBEI_RESPOND_NAME = "BEIANBEI_RESPOND_PROTOCOL";
	// 贝安贝客户端响应协议
	public static final String BEIANBEI_RESPOND_PATTERN = "[0-9a-zA-Z][0-9a-zA-Z]\\*\\d{10}\\*[0-9a-fA-f]{4}\\*(SMSONOFF|MONITOR|REMOVE|WHITELIST(1|2)|SOS(1|2|3)?)";
	
	/************************* 北斗小护士公司协议正则 ****************************/
	// 小护士公司名字
	public final static String NURSE_NAME = "NURSE";
	// 小护士链接协议
	// public final static String IPARENT_POSITION_PATTERN = "^\\[V\\d+.\\d+.\\d+,.*,1,abcd,\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2},\\d-\\d,\\d{15},(-)?\\d,T\\d+,GPS_T\\d+,\\d+(.\\d+)?,\\d+(.\\d+)?,.*,\\d+(.\\d+)?,\\d+(.\\d+)?,\\d+\\]$";
	// 小护士链接协议名称
	public final static String NURSE_LINK_NAME = "NURSE_LINK_PROTOCOL";
	// 小护士链接协议
	public static final String NURSE_LINK_PATTERN = "V\\d+.\\d+.\\d+,.*,1,abcd,\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2},1-2,\\d{15},(-)?\\d,T\\d+";
	// 小护士多基站定位协议名称
	public final static String NURSE_MULTILBS_NAME="NURSE_POSITION_PROTOCOL";
    // 小护士多基站协议
	public static final String NURSE_MULTILBS_PATTERN = "V\\d+.\\d+.\\d+,.*,1,abcd,\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2},1-2,\\d{15},(-)?\\d,T\\d+,\\d+(.\\d+)?,.*,\\d+";
	// 小护士单基站定位协议名称
	public final static String NURSE_LBS_NAME="NURSE_LBS_PROTOCOL";
	// 小护士单基站协议
	public static final String NURSE_LBS_PATTERN = "V\\d+.\\d+.\\d+,.*,1,abcd,\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2},1-2,\\d{15},(-)?\\d,T52,LBS,\\d+,\\d+,\\d+,\\d+";
	// 小护士GPS定位协议名称
	public final static String NURSE_GPS_NAME="NURSE_GPS_PROTOCOL";
	// 小护士GPS协议
	public static final String NURSE_GPS_PATTERN = "V\\d+.\\d+.\\d+,.*,1,abcd,\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2},1-2,\\d{15},(-)?\\d,T53,GPS,(\\d+(.\\d+)?,){5}\\d+";	    
	
	
	// 公司和协议的绑定关系
	
	public static final Map<String,String> protocolMap = new HashMap<String,String>();
	static{
		protocolMap.put(HEREMI_POSITION_PATTERN, HEREMI_POSITION_NAME);
		protocolMap.put(IPARENT_GPS_PATTERN, IPARENT_GPS_NAME);
		protocolMap.put(BEIANBEI_LINK_PATTERN, BEIANBEI_LINK_NAME);
		protocolMap.put(BEIANBEI_POSITION_PATTERN, BEIANBEI_POSITION_NAME);
		protocolMap.put(BEIANBEI_RECORD_PATTERN, BEIANBEI_RECORD_NAME);
		protocolMap.put(BEIANBEI_RESPOND_PATTERN, BEIANBEI_RESPOND_NAME);
		protocolMap.put(BEIANBEI_ALARM_PATTERN, BEIANBEI_ALARM_NAME);
		protocolMap.put(NURSE_LINK_PATTERN, NURSE_LINK_NAME);
		protocolMap.put(NURSE_MULTILBS_PATTERN, NURSE_MULTILBS_NAME);
		protocolMap.put(NURSE_LBS_PATTERN, NURSE_LBS_NAME);
        protocolMap.put(NURSE_GPS_PATTERN, NURSE_GPS_NAME);
//		protocolMap.put(BEIANBEI_LINK_PATTERN, BEIANBEI_POSITION_NAME);
	}
	
}
